package frontend.model.settings;

import backend.model.base.DBModel;
import backend.model.other.User;
import frontend.model.base.UIModel;
import shared.util.MD5CryptographyUtil;

public class SettingsUIModel implements UIModel {

    private String newPassword;
    private String confirmedNewPassword;
    private User user;
    private User loggedInUser;

    public SettingsUIModel(User loggedInUser) {
        this.loggedInUser = loggedInUser;
    }

    public String getNewPassword() {
        return newPassword;
    }

    public String getConfirmedNewPassword() {
        return confirmedNewPassword;
    }

    public User getUser() {
        return user;
    }

    @Override
    public DBModel getDBModel() {
        return loggedInUser;
    }

    @Override
    public void populateDBModelFromFields() {
        loggedInUser.setPassword(MD5CryptographyUtil.encrypt(newPassword));
    }

    @Override
    public void populateFieldsFromDBModel() {
    }
}